package heliotrope.res
{
	import flash.utils.Dictionary;
	
	import heliotrope.global.ErrorHandler;
	import heliotrope.net.loader.ITargetHost;
	import heliotrope.net.loader.LoadState;
	import heliotrope.res.manager.GraphicLoadManager;
	public class GraphicResource implements ITargetHost
	{
		private var _graphics:Dictionary;
		private var _name:String;
		public function GraphicResource(name_:String, graphicList_:Vector.<String>)
		{
			_name = name_;
			initGraphics(graphicList_);
		}
		
		private function initGraphics(graphicList_:Vector.<String>):void
		{
						
		}
		
		public function getResource(name_:String):BitmapdataDistributor
		{
			var loaderManager:GraphicLoadManager = GraphicLoadManager.getInstance();
			var graphic:BitmapdataDistributor = _graphics[name_];
			if(graphic.loadState == LoadState.NOT_LOAD)
			{
				graphic.loadState = LoadState.PRE_LOAD;
				loaderManager.loadGraphic(_name, name_, this, graphic);
			}
			return graphic;
		}
		
		public function setLoadState(state_:LoadState):void
		{
			state_.target.loadState = state_.state;
		}
	}
}